public class TestDemo {
    public static void inorder(BinarySearchTree.Node root) {
        if(root == null) {
            return;
        }
        inorder(root.left);
        System.out.print(root.val+" ");
        inorder(root.right);
    }

    public static void preorder(BinarySearchTree.Node root) {
        if(root == null) {
            return;
        }
        System.out.print(root.val+" ");
        preorder(root.left);
        preorder(root.right);
    }

    public static void main(String[] args) {
        BinarySearchTree binarySearchTree = new BinarySearchTree();
        binarySearchTree.insert(13);
        binarySearchTree.insert(1);
        binarySearchTree.insert(21);
        binarySearchTree.insert(14);
        binarySearchTree.insert(5);
        binarySearchTree.insert(6);

        inorder(binarySearchTree.root);
        System.out.println();

        preorder(binarySearchTree.root);
        System.out.println();

        System.out.println(binarySearchTree.search(1).val);
        binarySearchTree.remove(13);

        inorder(binarySearchTree.root);
        System.out.println();
        preorder(binarySearchTree.root);
        System.out.println();
    }
}